//
//  Emoticon.m
//  WLEmotionKeyBoard
//
//  Created by wanglei on 16/12/6.
//  Copyright © 2016年 wanglei. All rights reserved.
//

#import "Emoticon.h"

@implementation Emoticon

- (void)setPng:(NSString *)png{
    _png = png;
    if (self.id == nil && png == nil) {
        return;
    }
//    妈的,少品一个斜杠,耽误了二天
    self.imagePath = [NSString stringWithFormat:@"%@/Emoticons.bundle/%@/%@",[NSBundle mainBundle].bundlePath,_id,png];
}

- (void)setCode:(NSString *)code{
    _code = code;
    if (code == nil) {
        return;
    }
    self.emojiStr = [code emoji];
}

-(id)initWithid:(NSString *)id dict:(NSDictionary *)dict;{
    self.id = id;
    self = [super init];
    if(self){
        [self setValuesForKeysWithDictionary:dict];
    }
    return self;
}

-(id)initWithisDelete:(BOOL)isDelete;{
    self = [super init];
    if (self) {
        self.isDelete = isDelete;
    }else{
//        设定的初始值
        self.isDelete = false;
    }
    return self;
}
-(id)initWithisEmpty:(BOOL)isEmpty;{
    self = [super init];
    if (self) {
        self.isEmpty = isEmpty;
    }else{
//        设定的初始值
        self.isEmpty = false;
    }
    return self;
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key;{}
-(NSString *)description;{
    NSArray *keys = @[@"chs",@"png",@"code"];
    NSDictionary<NSString *, id> *dict = [self dictionaryWithValuesForKeys:keys];
    return [dict description];
}
@end
